<?php
// +----------------------------------------------------------------------
// * Created by PhpStorm.
// +----------------------------------------------------------------------
// * Author: D H
// +----------------------------------------------------------------------
// * Date: 2017/9/14
// +----------------------------------------------------------------------
// * Time: 9:33
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\logic\Product as Products;
use think\Request;
use tool\Common;
class Product extends Base{

    ////谦程得到产品状
    public function getAuditProduct(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->getAuditProduct();
        Common::json($package);
    }

    //根据状态码得到产品状态   商家通用
    public function getSellProduct(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->getSellProduct();
        Common::json($package);
    }

    //修改产品信息 (审核未通过产品)
    public function updateProduct(){
        /*$data = [
            'productID' => 1,   //商家ID
            'catalogID' => 14,  //分类ID
            'brandName' => '安然' ,    //品牌名称
            'name' => '闪亮咔咔咔',          //产品名称
            'model' => 'm233300',        //型号
            'manufacturer' =>'上海畅为科技有限公司',  //制造商
            'origin' => '上海',        //产地
            //'score' => ''          //产品得分
            'class' => 0,           // 类别0国产1进口
            //'specification' => '',    //说明书
            'price' => 23359,    //协议价
            'details' =>[
                'xxxxxx.jpg',
                'xxxxxx.jpg',
                'xxxxxx.jpg',
                'xxxxxx.jpg'
            ],                         //商品详情
            'titleImage' => [          //商品展示细节图
                'xxxxxx.jpg',
                'xxxxxx.jpg',
                'xxxxxx.jpg',
                'xxxxxx.jpg'
            ],
            'parameterList' => ''      //产品参数
        ];*/
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->updateProduct();
        Common::json($package);
    }

    //得到产品信息
    public function getUpProductMsg(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->getUpProductMsg();
        Common::json($package);
    }

    //订单完成商品评价
    public function productEvaluation(){
       /* $data = [
            'productID' => 7,
            'content' => '这件东西还不错',
            'praise' => 2,
            'star' => 4
        ];*/
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->productEvaluation();
        Common::json($package);
    }

    //得到未评价商品(买家)
    public function notAppraise(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->notAppraise();
        Common::json($package);
    }

    //得到已评价商品(买家)  status = 5
    public function appraise(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->appraise();
        Common::json($package);
    }

    //得到未评价商品(商家)  status = 4
    public function SNotAppraise(){
       $data = Request::instance()->post();
        $object = new Products();
        $package = $object->SNotAppraise();
        Common::json($package);
    }

    //得到已评价商品(商家)  status = 5
    public function SAppraise(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->SAppraise();
        Common::json($package);
    }

    //谦程得到待审核产品信息
    public function getWaitProductMsg(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->getWaitProductMsg();
        Common::json($package);
    }

    //得到分类列表
    public function getCatList(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->getCatList();
        Common::json($package);
    }

    //供应商得到总队审核产品列表
    public function getItemProduct(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->getItemProduct();
        Common::json($package);
    }

    //供应商店铺
    public function sellerShop(){
        $data = Request::instance()->post();
        $object = new Products();
        $package = $object->init($data)->sellerShop();
        Common::json($package);
    }

}